With this function you can get GameMaker Studio 2 to check the currently opened file to see if the line being read has finished. The function returns true if the end of the line has been reached and false otherwise.
file_text_eoln(fileid);
| Argument | Description |
|---|---|
| fileid | The id of the file to check. |
Boolean
var file = file_text_open_read(working_directory +
"Game_Data.txt");
var num = 0; while (!file_text_eoln(file))
{
score_array[num] =
file_text_read_real(file);
num++;
}
file_text_close(file);
The above code opens a file for reading then reads the values from a single line into an array.